﻿@using RooHui.Infrastructure.Entities.Enum;
@{
    
    ViewBag.Title = "ProjectDetails";
    Layout = "~/Views/Shared/_Base.cshtml";
    var project = ViewBag.project;
    if (project != null)
    {
        foreach (var policy in project.PolicyList)
        {
            if (!policy.IsAttach)
            {
                project.Policy = policy;
            }
        }
    }
}
@section head{
<script type="text/javascript" src="/Content/roohui/jquery-validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="/Content/roohui/jquery-validation/jquery.metadata.js"></script>
<script type="text/javascript" src="/Content/roohui/jquery-validation/messages_cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/ueditor/editor_all_min.js"></script>
}

<script type="text/javascript">
    var prodeseditor = null;
    var sepecids = [];
    var proresnames = [];
    $(function () {
        $('input[name="btnClose"]').click(function () {
            location.href = decodeURIComponent("/Project/Index");
        });

    })

</script>

<div style="overflow-x:hidder;overflow-y:auto;height:100%">
<form id="frmProject" name="frmProject" style="background-color: white">
<input name="ProductID" type="hidden"/>
<input name="SpePolicyIDs" type="hidden"/>
<input name="ProResNames" type="hidden"/>
<input name="GuarCpyID" type="hidden"/>
<input name="Status" type="hidden"/>

<div id="form1" class="liger-form" style="padding-top: 10px; padding-left:25px;">
    <div id="probaseinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>项目信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;产品名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="ProductName">@project.ProductName</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;项目名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="ProjectTitle">@project.ProjectTitle</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;项目代码:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="ProjectCode">@project.ProjectCode</span> 
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;融资金额:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="Financing">@project.Financing 元</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;投资步长:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="IncreaseMoney">@project.IncreaseMoney 元</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;最大投资额:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="IncreaseMoney">@project.IncreaseMoney 元</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;借款利率:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="OriginalRate">@project.OriginalRate %</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;担保费率:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="GuaranteeRate">@project.GuaranteeRate %</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;还款期数:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <span name="CycleAmount">@project.CycleAmount</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;有效期:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="WaitDay">@project.WaitDay 天</span> 
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;项目描述:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5"  style="width:800px; word-break:break-all; word-wrap:break-word;">
                    <span name="ProjectDescription">@project.ProjectDescription</span> 
                </td>
            </tr>
        </table>
    </div>
    <div id="enterpriseinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>企业信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;企业名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="EnterpriseName">@project.Enterprise.EnterpriseName</span> 
                </td>
                <td align="right" class="l-table-edit-td">
                    企业代码:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="EnterpriseCode">@project.Enterprise.EnterpriseCode</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    企业信用: 
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="EnterpriseCredit">@project.Enterprise.EnterpriseCredit</span> 
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star"></span>&nbsp;企业信息:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5" style="width:800px; word-break:break-all; word-wrap:break-word;">
                    <span name="EnterpriceInfo">@project.Enterprise.EnterpriceInfo</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;资金用途:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5" style="width:800px; word-break:break-all; word-wrap:break-word;">
                    <span name="CapitalOperation">@project.Enterprise.CapitalOperation</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="guarcpyinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>风险控制</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;担保公司:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="GuaranteeCompany">@project.GuaranteeCompany.CompanyName</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    担保意见:
                </td>
                <td align="left" class="l-table-edit-td" style="width:800px; word-break:break-all; word-wrap:break-word;">
                    <span name="CollateralOpinion">@project.CollateralOpinion</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;风险控制:
                </td>
                <td align="left" class="l-table-edit-td" colspan="3" style="width:800px; word-break:break-all; word-wrap:break-word;">
                    <span name="RiskCotrolSummary">@project.RiskCotrolSummary</span>  
                </td>
            </tr>
        </table>
    </div>
    <div id="policyinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>策略信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;策略名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="PolicyName">@project.Policy.PolicyName</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;结算周期:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="Duration">@project.Policy.Duration
                    @{
                    if (project.Policy.DurationType == DurationType.ByDay)
                    {
                        <span name="DurationType">天</span>
                    }
                    else if (project.Policy.DurationType == DurationType.ByMonth)
                    {
                        <span name="DurationType">月</span>
                    }
                    }
                    </span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;计算方式:
                </td>
                <td align="left" class="l-table-edit-td">
                @{
                    if (project.Policy.SettlementType == SettlementType.Proportion)
                    {
                        <span name="SettlementType">按比例</span>
                    }
                    else if (project.Policy.SettlementType == SettlementType.Fixed)
                    {
                        <span name="SettlementType">固定值</span>
                    }
                    }
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;结算方式:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                @{
                    string temvalue = "";
                    BalanceType baltype = project.Policy.BalanceType;
                    switch (baltype)
                    {
                        case BalanceType.AverCapitalInterest:
                            temvalue = "每期等额本金利息";
                            break;
                        case BalanceType.EachInterestTerminalCapital:
                            temvalue = "每期结息到期还本";
                            break;
                        case BalanceType.TerminalCapitalInterest:
                            temvalue = "到期结本息";
                            break;
                        case BalanceType.EverageFixed:
                            temvalue = "每期固定收益";
                            break;
                        case BalanceType.TerminalFixed:
                            temvalue = "到期固定收益";
                            break;
                    }
                    <span name="BalanceType">@temvalue</span>
                    }
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年化收益:
                </td>
                <td align="left" class="l-table-edit-td">
                    <span name="Rate">@project.Policy.Rate
                    @{
                    if (project.Policy.SettlementType == SettlementType.Proportion)
                    {
                        <span id="danwei" ligerui="width:60" style="width:60;">%</span>
                    }
                    else if (project.Policy.SettlementType == SettlementType.Fixed)
                    {
                        <span id="danwei" ligerui="width:60" style="width:60;">元</span>
                    }
                    }
                    </span>
                </td>
            </tr>
            <tr id="spepolicy">
                <td align="right" class="l-table-edit-td">
                    <span class="l-star"></span>&nbsp;特殊策略:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5">
                @{
                    foreach (var policy in project.PolicyList)
                    {
                        if (policy.IsAttach)
                        {
                            var durationtype = policy.DurationType == DurationType.ByDay ? "日" : "月";
                            var balancetype = "";
                            BalanceType balType = policy.BalanceType;
                            switch (balType)
                            {
                                case BalanceType.AverCapitalInterest:
                                    balancetype = "每期等额本金利息";
                                    break;
                                case BalanceType.EachInterestTerminalCapital:
                                    balancetype = "每期结息到期还本";
                                    break;
                                case BalanceType.EverageFixed:
                                    balancetype = "每期固定收益";
                                    break;
                                case BalanceType.TerminalCapitalInterest:
                                    balancetype = "到期结本息";
                                    break;
                                case BalanceType.TerminalFixed:
                                    balancetype = "到期固定收益";
                                    break;
                                default:
                                    balancetype = "每期等额本金利息";
                                    break;
                            }
                            var settlementtype = policy.SettlementType== SettlementType.Fixed ? "固定值" : "按比例";
                            var tempstr = "[" + policy.PolicyName + "]" + "年化收益" + policy.Rate + "分" + policy.CycleAmount + "期(" + policy.Duration + durationtype + "/期)" + settlementtype + "以" + balancetype + "结算";
                            <span name="SpePolicy">@tempstr</span><br />
                        }
                    }
                    }
                </td>
            </tr>
        </table>
    </div>
    <div id="proresource" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>项目资料</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    &nbsp;协议资料:
                </td>
                <td align="left" class="l-table-edit-td">
                @{
                    foreach (var resource in project.ResourceList)
                    {
                        <img alt="@resource.Name" title="@resource.Name" src="@resource.Path" style="width:115px; height:95px;"/>
                    }
                }
                </td>
            </tr>
        </table>
    </div>
    <div id="btn" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="center" style="width:70px;"></td>
                <td align="center">
                    <input type="button" value="关闭" name="btnClose" class="l-button" />
                </td>
            </tr>
        </table>
    </div>
    <br />
</div>

</form>
</div>